#version 460


layout(binding = 0) uniform CameraUbo {
    mat4 proj;
    mat4 view;
    vec3 cameraPos;
} cameraUbo;

layout(binding = 1) uniform ObjectUbo {
    mat4 model;
} objectUbo;

layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec2 inUV;

layout(location = 0) out vec3 outPosition;
layout(location = 1) out vec3 outNormal;
layout(location = 2) out vec2 outUV;

out gl_PerVertex
{
    vec4 gl_Position;
};

void main()
{
    gl_Position = cameraUbo.proj * cameraUbo.view * objectUbo.model * vec4(inPosition, 1.0);
    outPosition = vec3(objectUbo.model * vec4(inPosition, 1.0));
    outNormal = normalize(mat3(objectUbo.model) * inNormal);
    outUV = inUV;
}
